package com.zlzxm.shoesmarket.view.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.module.LoadMoreModule;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.zlzxm.shoesmarket.R;
import com.zlzxm.shoesmarket.util.ZViewHelp;
import com.zlzxm.shoesmarket.view.adapter.entity.EntityAddGoodsInfo;

import org.jetbrains.annotations.NotNull;

/**
 * CREATE BY zlzxm ON 4/15/21
 */
public class ADAddGoodInfoAdapter extends BaseQuickAdapter<EntityAddGoodsInfo, BaseViewHolder> implements LoadMoreModule {
    public ADAddGoodInfoAdapter() {
        super(R.layout.item_add_goods_info);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, EntityAddGoodsInfo entity) {


        RequestOptions requestOptions = new RequestOptions().transform(new CenterCrop(),
                new RoundedCorners(ZViewHelp.dpTopx(getContext(),
                4)));

        Glide.with(getContext())
                .load(entity.getFace())
                .apply(requestOptions)
                .into((ImageView) holder.getView(R.id.ivFace));


        holder.setText(R.id.tvTitle,entity.getTitle());
        holder.setText(R.id.tvDesc,entity.getDesc());

    }
}
